package com.fy.springcloudtest.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

@RefreshScope
@RestController
public class GoodsController {

    @Value("${mysqldb.datasource.url:''}")
    private String databases;

    @GetMapping("/goods/list")
    public List<String> getGoodsList() {
//        try {
//            Thread.sleep(2000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }

        return Arrays.asList("rich", "poor");
    }

    @GetMapping("/goods/databases")
    public String getGoodsDatabases() {
        return databases;
    }
}
